import { defineStore } from "pinia";
import { ref, computed } from "vue";

const storeSetup = () => {
  /* 定义数据--------------------------------------------------------------------- */
  // 当前的tabbar索引
  const currentTabbarIndex = ref(0);

  // 当前的页面路由信息
  const currentPageRouteInfo = ref({
    path: "",
    name: "",
    component: null,
    meta: {
      title: "",
      icon: "",
      isCustomIcon: null,
      isNavBar: null,
      iconCustomIcon: {
        default: "",
        active: "",
      },
    },
  });

  /* 定义函数--------------------------------------------------------------------- */

  // 返回参数
  return {
    currentTabbarIndex,
    currentPageRouteInfo,
  };
};

// 导出Store
export const useTabbarStore = defineStore("tabbar", storeSetup, {
  persist: true,
});
